import { RootObject } from './types/rootObject'
import { Article, List } from './types/article'
import request from './request/requestToken'

export const getArticleList = (data: any) => request<RootObject<List<Article>>>({
  method: 'POST',
  url: '/mrs-house/page',
  data,
})

export const createArticle = (data: any) => request<RootObject<Article>>({
  method: 'POST',
  url: '/table/add',
  data,
})

export const updateArticle = (data: any) => request<RootObject<Article>>({
  method: 'POST',
  url: '/table/update',
  data,
})

export const deleteArticle = (id: any) => request<RootObject<Article>>({
  method: 'GET',
  url: `/table/delete/${id}`,
})

  // 通过父级code查询省市区(1级列表传'0'，其他传父级code)
  export const getListByParentCode = (params: any) => request<RootObject<any>>({
    method: 'GET',
    url: '/area/getListByParentCode',
    params,
  })